# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

_gemname=immutable-struct
pkgname=ruby-${_gemname}
pkgver=2.4.1
pkgrel=2
pkgdesc="Create struct-like classes that don't have setters, but have an awesome constructor"
url='https://github.com/stitchfix/immutable-struct'
arch=('any')
license=('MIT')
depends=('ruby')
makedepends=('rubygems' 'ruby-rdoc')
options=('!emptydirs')
source=(https://github.com/stitchfix/immutable-struct/archive/v${pkgver}/${pkgname}-v${pkgver}.tar.gz)
sha512sums=('cddf4139c3682714b3dcb785c155daa8ad4d275e3faf59c675476b76e8ed3fb9bdfa805c9bc741bd3d541e45b89f7afea13d3f70af8490a06a0da1d68ed4040c')
b2sums=('e67119596f47e096403e7d08eab2eb026a618966f50b9a7f5c93a6f2264612ea0e62f4a4899b4546faa432607da92412fa4e82f61d0a984b0d724e03627b9069')

prepare() {
  cd ${_gemname}-${pkgver}
  sed -r 's|~>|>=|g' -i ${_gemname}.gemspec
  sed 's|git ls-files|find|' -i ${_gemname}.gemspec
}

build() {
  cd ${_gemname}-${pkgver}
  gem build ${_gemname}.gemspec
}

package() {
  cd ${_gemname}-${pkgver}
  local _gemdir="$(gem env gemdir)"
  gem install --ignore-dependencies --no-user-install -i "${pkgdir}${_gemdir}" \
    -n "${pkgdir}/usr/bin" ${_gemname}-${pkgver}.gem
  install -Dm 644 README.rdoc -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
  rm -r "${pkgdir}/${_gemdir}/cache"
}

# vim: ts=2 sw=2 et:
